Unify density-control argument defaults#538
Unify density-control argument defaults#538utkarshpawade wants to merge 3 commits intostan-dev:masterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR standardizes how density-control arguments (bw, adjust, kernel, n_dens) are defaulted across PPC/PPD density-overlay functions to match the broader “density-like” plotting API, by switching user-facing defaults to NULL and applying internal %||% fallbacks to preserve existing behavior.
Changes:
- Updated
ppc_dens_overlay(),ppc_dens_overlay_grouped(), andppd_dens_overlay()to default density controls toNULLand set effective defaults internally. - Extended
compute_interval_density()to apply%||%fallbacks forbw/adjust/kernel. - Updated shared roxygen template + regenerated
.Rdfiles; added a NEWS entry.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| R/ppd-distributions.R | Switches ppd_dens_overlay() density-control defaults to NULL with internal fallbacks. |
| R/ppc-distributions.R | Switches ppc_dens_overlay*() density-control defaults to NULL with internal fallbacks (via ppc_dens_overlay()). |
| R/mcmc-intervals.R | Adds `% |
| man-roxygen/args-density-controls.R | Updates the shared parameter documentation for density controls. |
| man/PPD-distributions.Rd | Regenerated docs reflecting the updated defaults and parameter text. |
| man/PPC-distributions.Rd | Regenerated docs reflecting the updated defaults and parameter text. |
| man/MCMC-intervals.Rd | Regenerated docs reflecting the updated density-controls template text. |
| man/MCMC-distributions.Rd | Regenerated docs reflecting the updated density-controls template text. |
| NEWS.md | Notes the change in defaults to NULL for affected functions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #538 +/- ##
=======================================
Coverage 99.19% 99.20%
=======================================
Files 35 35
Lines 6118 6129 +11
=======================================
+ Hits 6069 6080 +11
Misses 49 49 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jgabry
left a comment
There was a problem hiding this comment.
Thanks! I made two small review comments. And one other issue:
ppc_loo_pit_overlay() also has hard-coded bw = "nrd0", adjust = 1, kernel =
"gaussian", n_dens = 1024 defaults. Should it be updated here too for consistency? (The bw in ppc_loo_pit_data() is used for boundary-correction KDE so that one is probably fine to leave as-is and doesn't need changing.)
| bounds = NULL) { | ||
| bw <- bw %||% "nrd0" | ||
| adjust <- adjust %||% 1 | ||
| kernel <- kernel %||% "gaussian" |
There was a problem hiding this comment.
Can you revert the changes to this file? This internal function can be left as-is, it already handles NULL correctly.
| @@ -1,5 +1,6 @@ | |||
| # bayesplot (development version) | |||
|
|
|||
| * Changed `bw`, `adjust`, `kernel`, and `n_dens` defaults to `NULL` in `ppc_dens_overlay()`, `ppc_dens_overlay_grouped()`, and `ppd_dens_overlay()`. | |||
There was a problem hiding this comment.
| * Changed `bw`, `adjust`, `kernel`, and `n_dens` defaults to `NULL` in `ppc_dens_overlay()`, `ppc_dens_overlay_grouped()`, and `ppd_dens_overlay()`. | |
| * Unified density-control argument defaults (bw, adjust, kernel, n_dens) to use `NULL` with internal fallbacks. No change in user-facing behavior. |
Fixes #131
Unifies density-control defaults across the
ppc_*/ppd_*density-overlay functions with themcmc_areas*/mcmc_dens*family.ppc_dens_overlay(),ppc_dens_overlay_grouped(),ppd_dens_overlay():bw,adjust,kernel,n_densdefaults changed from hard-coded values toNULL, with%||%fallbacks applied internally.compute_interval_density():%||%fallbacks extended tobw/adjust/kernel.args-density-controlstemplate: documents all four defaults..Rdfiles.Behavior is preserved.
NULLresolves to the previously hard-coded values.